package com.zufe.test4;

public class PhoneTest {
    public static void main(String[] args) {
        Phone[] phones = new Phone[3];
        Phone p1 = new Phone("Apple", 5999, "Black");
        Phone p2 = new Phone("Samsung", 3999, "White");
        Phone p3 = new Phone("Huawei", 2999, "Blue");
        phones[0] = p1;
        phones[1] = p2;
        phones[2] = p3;
        int sum = 0;
        for (int i = 0; i < phones.length; i++) {
            sum += phones[i].getPrice();
        }
        int avg = sum / phones.length;
        System.out.println("The average price of the phones is: " + avg);
    }
}
